#!/bin/bash
if [[ -n $1 ]]; then
    cmd=$1
else
    cmd=jps
fi
for host in hadoop162 hadoop163 hadoop164 ; do
    echo ========== 在 $host 上执行 $cmd ==========
    ssh atguigu@$host "source /etc/profile ; $cmd" 
done
